<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>告警策略明细</title>
    <%@include file="/common/commonCSS.jsp" %>
    <%@include file="/common/commonJS.jsp" %>
    <%@include file="/WEB-INF/jsp/include/taglib.jsp" %>
</head>

<body>
    <div class="main-container" id="main-container">

        <div class="row" style="margin-top: 20px;">
            <div class="col-md-12">
                <form class="layui-form" id="search-from" action="${webRoot}/sla/slaalertdef/list">
                    <div class="layui-form-item">
                        <button class="layui-btn  layui-btn-small" type="button" onclick="addInfo()"><i class="layui-icon">&#xe61f;</i> 编辑</button>
                        <%--<a class="layui-btn" href="${webRoot}/sys/timetblworkdate/info"><i class="layui-icon">&#xe61f;</i> 新 增</a>--%>
                    </div>
                </form>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <table id="table-list" class="layui-table">
                    <thead>
                        <tr>
                            <th>升级类型</th>
                            <th>升级阈值</th>
                            <th>所属流程</th>
                            <th>关联通知模板</th>
                            <th>操作</th>

                        </tr>
                    </thead>
                    <tbody>
                        <c:forEach items="${slaAlertDefList}" var="slaAlertDef" varStatus="i">
                            <tr id="${slaAlertDef.id }">
                                <td style='display: none'>
                                    <input name='slaAlertDefIds' value='${slaAlertDef.id}'/>
                                </td>
                                <td>${fns:getCodeName("up_type",slaAlertDef.upType)}</td>
                                <td>${slaAlertDef.upValue}</td>
                                <td>${fns:getCodeName("table_name",slaAlertDef.flowcode)}</td>
                                <td>${slaAlertDef.noteruleId}</td>
                                <td>
                                    <div class=" btn-group ">
                                        <button class="layui-btn layui-btn-danger layui-btn-small" type="button" onclick="addInfo('${slaAlertDef.id}')"><i class="layui-icon">&#xe642;</i> 编辑</button>
                                        <%--<a class="layui-btn layui-btn-small" href="${webRoot}/sys/timetblworkdate/info?id=${timetblWorkdate.id}" ><i class="layui-icon">&#xe642;</i>编辑</a>--%>

                                        <%--<c:if test="${timetblWorkdate.workDateType == 1}">--%>
                                                  <button class="layui-btn layui-btn-danger layui-btn-small" type="button" onclick="deleteById('${slaAlertDef.id}')"><i class="layui-icon">&#xe640;</i>删除</button>
                                        <%--</c:if>--%>


                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                    </tbody>
                </table>

            </div>
        </div>
    </div>
</body>
<script src="${webRoot}/js/activiti/actSumbit.js"></script>
<script>
    function deleteById(id) {
        var url ="${webRoot}/sla/slaalertdef/delete";
        confirm('确定要删除选中的记录？', function(){
            $.post(url,"id="+id,function (r) {
                if(r.code=='0'){
                    toast(r.msg);
                    $("#"+id+"").remove();
                    //location.href='${webRoot}/sys/timetblworkdate/list';
                }else {
                    alertMsg(r.msg);
                }
            });
        });
    }
    /**
     * 选择审批人
     */
    function addInfo(slaAlertDefId) {

        var url="${webRoot}/sla/slaalertdef/info?id"+(slaAlertDefId==undefined?"":"?id="+slaAlertDefId);
        //弹框层
        layer.open({
            scrollbar: true,
            type: 2,
            title : ['添加' , true],
            area: ['90%', '90%'], //宽高
            content: [url],
            shadeClose : false,
        });
    }

</script>

</html>